package cn.njupt;

public class Stack<E> {

    private List<E> list=new ArrayList<>();


    public void clear(){
        list.clear();
    }

    public int size(){
        return list.size();
    }


    public boolean isEmpty(){
        return list.isEmpty();
    }

    public E pop(){
        E element=list.get(list.size()-1);
        list.remove(list.size()-1);
        return element;
    }

    public E peek(){
        return list.get(list.size()-1);
    }

    public void push(E element){
        list.add(element);
    }


}
